package com.wish.wishhouse_resource.controller;


import com.github.pagehelper.PageInfo;
import com.wish.wishhouse_resource.entity.TbRoomInfo;
import com.wish.wishhouse_resource.service.ITbRoomInfoService;
import dto.houseResourceDto.RoomDto;
import com.wish.wishhouse_resource.entity.TMTenant;
import com.wish.wishhouse_resource.entity.TbPublicFacility;
import com.wish.wishhouse_resource.entity.TbRoomInfo;
import com.wish.wishhouse_resource.service.ITbRoomInfoService;
import com.wish.wishhouse_resource.entity.TbRoomInfo;
import com.wish.wishhouse_resource.service.ITbRoomInfoService;
import dto.houseResourceDto.PageRoomStatusDto;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vo.ResultEntity;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhangshuxin
 * @since 2021-03-28
 */
@RestController
@RequestMapping("/tbRoomInfo")
/*@Log4j*/
public class TbRoomInfoController {

    @Autowired
    private ITbRoomInfoService iTbRoomInfoService;

    //房源图
    @RequestMapping("/showRoom")
    public ResultEntity showRoom(PageRoomStatusDto pageRoomStatusDto) {

        Map<String, Object> info = iTbRoomInfoService.roomStatusList(pageRoomStatusDto);
        return ResultEntity.ok("200", "列表查询成功1111", info);
    }

    //列表展示
    @RequestMapping("/list")
    public ResultEntity list(RoomDto roomDto) {
        PageInfo<TbRoomInfo> info = iTbRoomInfoService.pageList(roomDto);
        return ResultEntity.ok("200", "列表查询成功", info);
    }

    //推荐的房源
    @RequestMapping("/recommendedRooms")
    public ResultEntity upload(String[] recommendeds) {
        String s = iTbRoomInfoService.recommendedRooms(recommendeds);
        return ResultEntity.ok("200",s,"");
    }
    //推荐的房源
    @RequestMapping("/qxRecommendedRooms")
    public ResultEntity upload2(String[] recommendeds) {
        String s = iTbRoomInfoService.qxRecommendedRooms(recommendeds);
        return ResultEntity.ok("200",s,"");
    }

    /**
     * 付款方式-押
     *
     * @return
     */
    @RequestMapping("/getPaymentMortgageList")
    public ResultEntity getPaymentMortgageList() {
        List<Map<String, Object>> list = iTbRoomInfoService.getPaymentMortgageList();
        return ResultEntity.ok(list);
    }

    /**
     * 付款方式-付
     *
     * @return
     */
    @RequestMapping("/getPaymentPayList")
    public ResultEntity getPaymentPayList() {
        List<Map<String, Object>> list = iTbRoomInfoService.getPaymentPayList();
        return ResultEntity.ok(list);
    }
}

